﻿<!--***********************************************************************************

   Extended WPF Toolkit

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  **********************************************************************************-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Xceed.Wpf.DataGrid"
                    xmlns:conv="clr-namespace:Xceed.Wpf.DataGrid.Converters"
                    xmlns:views="clr-namespace:Xceed.Wpf.DataGrid.Views">

   <SolidColorBrush x:Key="gridControlBorderBrush"
                    Color="Navy" />

   <SolidColorBrush x:Key="errorBackgroundBrush"
                    Color="Red" />

   <SolidColorBrush x:Key="errorForegroundBrush"
                    Color="White" />

   <SolidColorBrush x:Key="warningBackgroundBrush"
                 Color="#FFFFAA0F" />

   <SolidColorBrush x:Key="warningForegroundBrush"
                    Color="Black" />


   <!-- Pen that is used to draw the drop mark when a ColumnHeader is dragged over another one. -->
   <!-- We do not use a DynamicResource since this instance of a Pen could be reused via multiple threads. See case: 113402. -->
   <Pen x:Key="dropMarkPen"
        Brush="{x:Static SystemColors.HighlightBrush}"
        Thickness="7" />

   <DataTemplate x:Key="groupByItemAscendingSortGlyph">
      <Canvas Height="4"
              Width="7">
         <Path Opacity="1"
               Data="M 3.59375,0.15625 C3.59375,0.15625 7,4 7,4 7,4 0,4 0,4 0,4 3.59375,0.15625 3.59375,0.15625 z"
               Fill="{Binding RelativeSource={RelativeSource Self},Path=(TextElement.Foreground)}" />

         <Path Opacity="1"
               Data="M 0.5,3.5 C0.5,3.5 3.5,0.5 3.5,0.5 "
               Stroke="{Binding RelativeSource={RelativeSource Self},Path=(TextElement.Foreground)}"
               StrokeThickness="1" />
      </Canvas>
   </DataTemplate>

   <DataTemplate x:Key="groupByItemDescendingSortGlyph">
      <Canvas Height="4"
              Width="7">
         <Path Opacity="1"
               Data="M 3.59375,4 C3.59375,4 7,0.15625 7,0.15625 7,0.15625 0,0.15625 0,0.15625 0,0.15625 3.59375,4 3.59375,4 z"
               Fill="{Binding RelativeSource={RelativeSource Self},Path=(TextElement.Foreground)}" />

         <Path Opacity="1"
               Data="M 0.5,0.5 C0.5,0.5 3.5,3.5 3.5,3.5 "
               Stroke="{Binding RelativeSource={RelativeSource Self},Path=(TextElement.Foreground)}"
               StrokeThickness="1" />
      </Canvas>
   </DataTemplate>

   <!-- ValueConverter that is used to map GridLineThickness properties (of type double)
        to Thickness structures that we can set to BorderThickness properties in the templates. -->
   <conv:ThicknessConverter x:Key="thicknessConverter" />


   <!--**************************
    * TEMPLATE: GroupByControl
    ************************** -->
   <ControlTemplate x:Key="aeroNormalColorGroupByControlTemplate"
                    TargetType="local:GroupByControl">

      <Border BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}">

         <Grid>
            <Grid>
               <Grid.RowDefinitions>
                  <RowDefinition Height="0.53*"/>
                  <RowDefinition Height="0.27*"/>
                  <RowDefinition Height="0.2*"/>
               </Grid.RowDefinitions>

               <Border Grid.RowSpan="3">
                  <Border.Background>
                     <LinearGradientBrush StartPoint="0,0.5"
                                          EndPoint="1,0.5">
                        <GradientStop Offset="0"
                                      Color="#044875"/>
                        <GradientStop Offset="1"
                                      Color="#196C77" />
                     </LinearGradientBrush>
                  </Border.Background>
               </Border>

               <Border Grid.Row="2">
                  <Border.Background>
                     <LinearGradientBrush StartPoint="0.5,0"
                                          EndPoint="0.5,1">
                        <GradientStop Offset="0"
                                      Color="#008CC1C6"/>
                        <GradientStop Offset="0.5"
                                      Color="#0F85BDC2"/>
                        <GradientStop Offset="0.96"
                                      Color="#AE80BBBF" />
                        <GradientStop Offset="1"
                                      Color="#B280BBBF" />
                     </LinearGradientBrush>
                  </Border.Background>
               </Border>

               <Border Grid.Row="0">
                  <Border.Background>
                     <LinearGradientBrush StartPoint="0.5,1"
                                          EndPoint="0.5,0">
                        <GradientStop Offset="0"
                                      Color="#26FFFFFF"/>
                        <GradientStop Offset="1"
                                      Color="#B1FFFFFF"/>
                        <GradientStop Offset="0.643"
                                      Color="#66FFFFFF"/>
                     </LinearGradientBrush>
                  </Border.Background>
               </Border>

               <!--This element has to be external to avoid being overlapped by the gradients-->
               <Border Grid.RowSpan="3"
                       BorderThickness="1"
                       BorderBrush="#093442">

                  <Border Grid.RowSpan="3"
                          BorderThickness="1"
                          BorderBrush="#7FFFFFFF"/>
               </Border>

            </Grid>

            <Border Opacity="0.5"
                    Background="{TemplateBinding Background}"/>

            <!-- This ContentPresenter displays the value of the NoGroupContent property
                 of the GroupByControl. This content must only be displayed when there are
                 no groups present, so we set its Visibility to Collapsed by default and
                 it is made visible via a trigger. -->
            <ContentPresenter x:Name="noGroupContentPresenter"
                              Margin="{TemplateBinding Padding}"
                              Content="{TemplateBinding NoGroupContent}"
                              VerticalAlignment="Center"
                              Visibility="Collapsed" />

            <!-- The GroupByControl is an ItemsControl, so it must have an ItemsPresenter in its
                 Template in order to layout and show its child items. The default ItemsPanel
                 of the GroupByControl is a "StaircasePanel", which layout its items in a
                 staircase-like pattern and draws connecting lines between the items. -->
            <ItemsPresenter Margin="{TemplateBinding Padding}" />

         </Grid>
      </Border>

      <ControlTemplate.Triggers>

         <!-- When there are no groups, make the NoGroupContent visible. -->
         <Trigger Property="HasItems"
                  Value="False">

            <Setter TargetName="noGroupContentPresenter"
                    Property="Visibility"
                    Value="Visible"/>
         </Trigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: GroupByItem
    ************************** -->
   <ControlTemplate x:Key="aeroNormalColorGroupByItemTemplate"
                    TargetType="local:GroupByItem">

      <Border BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}">

         <Grid>
            <Border x:Name="border1"
                    BorderBrush="#1AFFFFFF"
                    CornerRadius="2"
                    BorderThickness="1"/>

            <Border x:Name="border2"
                    BorderBrush="#80022841"
                    CornerRadius="2"
                    BorderThickness="1"
                    Margin="1"/>

            <Border x:Name="border3"
                    BorderBrush="#34FFFFFF"
                    CornerRadius="2"
                    BorderThickness="1"
                    Margin="2"/>

            <Border x:Name="topGradient"
                    Height="17"
                    VerticalAlignment="Top">
               <Border.Background>
                  <LinearGradientBrush StartPoint="0.5,1"
                                       EndPoint="0.503,0.039">
                     <GradientStop Offset="0"
                                   Color="#00FFFFFF"/>
                     <GradientStop Offset="1"
                                   Color="#4CFFFFFF"/>
                  </LinearGradientBrush>
               </Border.Background>
            </Border>

            <Border x:Name="bottomGradient"
                    Margin="2">
               <Border.Background>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">
                     <GradientStop Offset="0"
                                   Color="#99FFFFFF"/>
                     <GradientStop Offset="0.17"
                                   Color="#99FFFFFF"/>
                     <GradientStop Offset="1"
                                   Color="#00FFFFFF"/>

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.48747"
                                         CenterY="1.21575"
                                         Angle="-90"/>
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Border.Background>

               <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
               <StackPanel Orientation="Horizontal"
                           Margin="{TemplateBinding Padding}">

                  <ContentPresenter Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                  <ContentPresenter x:Name="sortGlyphPresenter"
                                    Margin="6,0,0,0"
                                    Content="{x:Null}"
                                    ContentTemplate="{StaticResource groupByItemAscendingSortGlyph}"
                                    Visibility="Hidden" />

               </StackPanel>

            </Border>
         </Grid>
      </Border>

      <ControlTemplate.Triggers>

         <Trigger Property="IsMouseOver"
                  Value="True">

            <Setter TargetName="border1"
                    Property="BorderBrush"
                    Value="#4DFFFFFF"/>

            <Setter TargetName="border2"
                    Property="BorderBrush"
                    Value="#52022841"/>

            <Setter TargetName="border3"
                    Property="BorderBrush"
                    Value="#71FFFFFF"/>

            <Setter TargetName="topGradient"
                    Property="Background">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.503,1.013"
                                       EndPoint="0.503,0.039">
                     <GradientStop Offset="0"
                                   Color="#19FFFFFF"/>
                     <GradientStop Offset="1"
                                   Color="#99FFFFFF"/>
                  </LinearGradientBrush>

               </Setter.Value>
            </Setter>

            <Setter TargetName="bottomGradient"
                    Property="Background">

               <Setter.Value>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">
                     <GradientStop Offset="0.0195"
                                   Color="#FFFFFFFF"/>
                     <GradientStop Offset="0.169"
                                   Color="#FFFFFFFF"/>
                     <GradientStop Offset="1"
                                   Color="#00FFFFFF"/>

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.487447"
                                         CenterY="1.21575"
                                         Angle="-90"/>
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Setter.Value>
            </Setter>

         </Trigger>

         <Trigger Property="IsPressed"
                  Value="True">

            <Setter TargetName="border1"
                    Property="BorderBrush"
                    Value="#4DFFFFFF"/>

            <Setter TargetName="border2"
                    Property="BorderBrush"
                    Value="#AE022841"/>

            <Setter TargetName="border3"
                    Property="BorderBrush">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.542,0.999"
                                       EndPoint="0.542,0.0231">
                     <GradientStop Offset="0"
                                   Color="#0A2F3B"/>
                     <GradientStop Offset="0.509"
                                   Color="#0A2F3B"/>
                     <GradientStop Offset="0.524"
                                   Color="#4D6B79"/>
                     <GradientStop Offset="1"
                                   Color="#4D6B79"/>
                  </LinearGradientBrush>
               </Setter.Value>
            </Setter>

            <Setter TargetName="topGradient"
                    Property="Background">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.503339,1.0131"
                                       EndPoint="0.503339,0.0388058">
                     <GradientStop Offset="0"
                                   Color="#17699EB5"/>
                     <GradientStop Offset="1"
                                   Color="#FF5E8799"/>
                  </LinearGradientBrush>
               </Setter.Value>
            </Setter>

            <Setter TargetName="bottomGradient"
                    Property="Background">

               <Setter.Value>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">

                     <GradientStop Offset="0.019"
                                   Color="#FF000000"/>
                     <GradientStop Offset="0.169"
                                   Color="#FF000000"/>
                     <GradientStop Offset="1"
                                   Color="#33000000"/>

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.487447"
                                         CenterY="1.21575"
                                         Angle="-90"/>
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Setter.Value>
            </Setter>

         </Trigger>

         <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
              depending on the ParentColumn's SortDirection. -->
         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                      Value="Ascending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible"/>

         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                      Value="Descending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="ContentPresenter.ContentTemplate"
                    Value="{StaticResource groupByItemDescendingSortGlyph}"/>

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible"/>

         </DataTrigger>
      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: ScrollTip
    ************************** -->
   <ControlTemplate x:Key="scrollTipTemplate"
                    TargetType="{x:Type local:ScrollTip}">

      <Grid VerticalAlignment="{TemplateBinding VerticalAlignment}"
            HorizontalAlignment="{TemplateBinding HorizontalAlignment}">

         <Border BorderThickness="1,1,1,1"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 Background="{TemplateBinding Background}"
                 CornerRadius="8"/>

         <Border BorderThickness="1,1,1,1"
                 Margin="1,1,1,1"
                 BorderBrush="#FFFFFFFF"
                 CornerRadius="8">

            <ContentPresenter VerticalAlignment="Center"
                              HorizontalAlignment="Right"
                              Margin="5"
                              TextElement.Foreground="{TemplateBinding TextElement.Foreground}"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>

         </Border>

      </Grid>

   </ControlTemplate>

</ResourceDictionary>
